<template>
  <div class="home-wrap">
    <CommonHeader />
    <div class="home-content">首页内容</div>
    <mds-button type="primary" @click="checkProtocol">唤起美事会话</mds-button>
    <!-- <mds-button type="primary" @click="openApp">在meishi中打开应用</mds-button> -->
    <mds-button @click="handleGetUUID">获取UUID</mds-button>
  </div>
</template>

<script lang="ts">
  import { Component, Vue } from 'vue-property-decorator'
  import CommonHeader from '@/components/header.vue'
  import { debounce, generateCustomLengthUUID } from '@epfe/utils'

  @Component({
    components: {
      CommonHeader
    }
  })
  export default class Main extends Vue {
    private async mounted() {
      console.log('%c=========== index ============')

      const handleResize = debounce(() => {
        console.log('Window resized!')
      }, 300)

      window.addEventListener('resize', handleResize)
    }
    handleGetUUID() {
      // 增加fancy-uuid的长度
      console.log(generateCustomLengthUUID(10))
    }
    checkProtocol() {
      window.gotoMeishi('person', '2020122210020041664b3a')
    }
    openApp() {
      window.meishi.quickPlay({
        type: 'openApp',
        params: {
          appId: '1', //应用id
          openType: 0, //0：打开工作台应用;1:独立窗口打开;2:默认浏览器打开;
          url: 'https://www.baidu.com' //应用url
        }
      })
    }
  }
</script>

<style lang="scss" scoped>
  .home-wrap {
    min-height: 100vh;
  }
</style>
